Conventional electronic control units for a vehicle are so constructed as to write particular data into an BEPROM (electrically-erasable and programmable read only memory) available for use in electrically updating the data. The particular data may be diagnostic information and control learning values etc. required to be continuously stored even if the supply of operation power source is suspended. This data is referred to as continuous storage object data. The electronic control unit thus constructed can continuously store and update the data even if a battery is disconnected or discharged completely.
As one of such electronic control units, JP-A-336351/1992 (Heisei 4) discloses a device so constructed as to sequentially copy and store, within an EEPROM, data of the predetermined domain of a RAM with a backup battery being charged. This RAM is referred to as a backup RAM. The device, when powered on, on detecting a failure in the data stored in the RAM, copies the data in the EEPROM to the RAM for recovery.
To cope with the limitation of a programmable non-volatile memory such as EEPROM in the number of times of data entry, JP-A-336351/1992 (Heisei 4) discloses a device that is so constructed as to save the number of times of data entry to EEPROM. The device makes a comparison between the data in the backup RAM and the data in the EEPROM in every fixed period, and copies the data in the backup RAM to the EEPROM if any differences are found.
Moreover, JP-A-217053/1999 (Heisei 4) discloses another method where data entry is performed only when data has been changed under the condition that a power source is turned off.
Meanwhile, in the case of the electronic control unit for vehicle, the RateBase monitoring method is specified in the regulation of the OBD (Onboard Diagnostic) 2 by the CARB (California Air Resources Board). In this RateBase monitoring method, the monitoring frequency expressed by the following formula must be stored continuously as the continuous storing object data.
Monitoring frequency=Number of times of Implementation of the monitoring/Number of times of operation
Here, the monitoring frequency indicates the frequency of implementation of the diagnosis. It is respectively applied to the diagnosis of a plurality of items such as catalytic converter, fuel evaporation system, oxygen sensor.
The number of times of operation (denominator) is the data which is incremented when the predetermined running condition specified in the regulation for this item. Moreover, the number of times of implementation of monitoring (numerator) is the data which are incremented when the diagnosis implementation condition specified by an automobile maker is specified for this item and determination for normal or irregular operation is completed.
Moreover, these denominator and numerator are once incremented during the period specified by ON and OFF of an ignition switch of a vehicle (that is, during the single operation period until the operation power source is turned off after this power source is turned on to an electronic control unit which implements the diagnosis) or maintain the present values. Therefore, when these denominator and numerator of each item are once incremented, the values are no longer updated during the present operation period of vehicle.
It is assumed that the electronic control unit continuously stores to the non-volatile memory such as EEPROM the data that are increased or decreased in its value like the numerator and denominator in the RateBase monitoring method, depending on the specified rule and that is changed in its value at the maximum only by N (where N is a positive number and N=1 in the RateBase monitoring method) during the single operation period from the time the unit is powered on to the time it is powered off. In this case, in order to save the number of times of data entry to the non-volatile memory, it is considered to use the method of JP-A-336351/1992 (Heisei 4).
However, in the method of JP-A-336351/1992 (Heisei 4), even if a value of the continuous storage object data is changed only by N during signal operation period of the electronic control unit and such a value can no longer be updated, the data in the backup RAM is compared with the data in the EEPROM in every period. Thus, useless processes are generated to a considerable degree. Particularly, in the EEPROM, data read/write operation is generally implemented through the serial communication between the microcomputers. Therefore, longer time is required for comparison between the data in the backup RAM and in the EEPROM and it is not effective to execute useless comparing processes.
Moreover, for example, it is also considered to write the continuous storage object data in the backup RAM into the programmable non-volatile memory such as EEPROM or the like only when the electronic control unit starts to operate. However, when the circuits are constructed to always implement the entry of continuous storage object data into the non-volatile memory bridging over the operation periods, the number of times of data entry can be reduced but the final value of data is stored only in the backup RAM while the device is not operated. Accordingly, if disconnection and complete discharge of battery are generated, it is no longer possible to surely update the data stored in the programmable non-volatile memory. This is also applied when a fault is generated in the standby RAM itself.
On the other hand, when the data is written into the programmable non-volatile memory such as the EEPROM or the like while the operation power source to the electronic control unit is turned off as in the case of JP-A-217053/1992 (Heisei 4), the operation power source is generally supplied to the electronic control unit only when the ignition switch is turned on or when a main relay for power feeding provided at the external side of the electronic control unit is turned on.
Accordingly, the electronic control unit may be constructed to continue the operation even after the ignition switch is turned off by turning on the main relay by itself after it is operated when the ignition switch is turned on. That is, upon detection that the ignition switch is turned off, the electronic control unit can prevent generation of the event that the operation power source is turned off before the continuous storage object data is completely written into the programmable non-volatile memory by implementing the procedures that the continuous storage object data on the RAM is written to the programmable non-volatile memory and thereafter the main relay is turned off.
However, even when the main relay is provided, since the battery voltage as the operation power source generally becomes unstable after the ignition switch is turned off, it is probable that the data in the programmable non-volatile memory cannot be updated. That is, if the microcomputer is reset due to the drop of the power source voltage, the latest continuous storage object data will be lost. Therefore, it is preferable that the continuous storage object data is entered to the programmable non-volatile memory, if it is possible, while the ignition switch is turned on.